package com.thinkingstar.iads.projectcenter.controller;

import java.io.File;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import com.alibaba.fastjson.JSONObject;
import com.thinkingstar.iads.common.filter.GlobalsFilter;
import com.thinkingstar.iads.common.filter.UserLoginFilter;
import com.thinkingstar.iads.common.jsonUtils.AjaxResult;
import com.thinkingstar.iads.common.utils.DownloadFileUtil;
import com.thinkingstar.iads.common.utils.POIFileUtil;
import com.thinkingstar.iads.common.utils.PictureUtil;

/**
 * 项目中心-cad设计相关
 * @author Administrator
 *
 */
@IocBean
@At("/projectCenter/singleDrawDesign")
@Filters({ @By(type = GlobalsFilter.class) , @By(type = UserLoginFilter.class)})
public class ProjectDrawDesignController {
	
	private static Log log = Logs.get();
	
	//单体图设计参数
	@At("/getJsonSingleDrawDesign/?")
	public void getJsonSingleDrawDesign(String data_json,HttpServletRequest req , HttpServletResponse rep){
		//将单体图设计参数封装json
		JSONObject data_obj = JSONObject.parseObject(data_json);
		String file_name = PictureUtil.createFileName("json");
		String re_path = POIFileUtil.getFileName(file_name, "json", "singleDrawDesign");
		String abs_path = POIFileUtil.getAbFileNameByRepath(re_path);
		File json_file = POIFileUtil.createJsonFile(data_json, abs_path);
		DownloadFileUtil.downLoadFile(json_file, file_name, req, rep);
	}

}
